package resource.pojo;

import java.sql.ResultSet;
import java.util.Date;

import models.util.MySqlDataAccessHelper;

public class Employee {
	private String id;
	private String user;
	private String password;
	private String re_password;
	private String fullname;
	private String phone;
	private Date birthday;
	private String address;
	private String email;
	private String sex;
	private String position;
	private String manager_id;
	private int department_id;
	private int role_id;
	private String description;
	private int accountant;
	private Date start_date;
	private String identity_card;
	private String bank_account;
	private String bank_name;
	private String employee_code;
	private int state;
	private String mobile;
	private Date end_date;
	private String img;
	private Department department;
	
	public Employee(String string, String string2, String string3, String string4, String string5, java.sql.Date date, String string6, String string7, String string8, String string9, String string10, int i, int j, String string11){}
	public Employee(String id, String fullname,String user,int department_id){
		this.id = id;
		this.fullname = fullname;
		this.user = user;
		this.department_id = department_id;
	}
	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getUser() {
		return user;
	}
	public void setUser(String user) {
		this.user = user;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getRe_password() {
		return re_password;
	}
	public void setRe_password(String re_password) {
		this.re_password = re_password;
	}
	public String getFullname() {
		return fullname;
	}
	public void setFullname(String fullname) {
		this.fullname = fullname;
	}
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	public Date getBirthday() {
		return birthday;
	}
	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getSex() {
		return sex;
	}
	public void setSex(String sex) {
		this.sex = sex;
	}
	public String getPosition() {
		return position;
	}
	public void setPosition(String position) {
		this.position = position;
	}
	public String getManager_id() {
		return manager_id;
	}
	public void setManager_id(String manager_id) {
		this.manager_id = manager_id;
	}
	public int getDepartment_id() {
		return department_id;
	}
	public void setDepartment_id(int department_id) {
		this.department_id = department_id;
	}
	public int getRole_id() {
		return role_id;
	}
	public void setRole_id(int role_id) {
		this.role_id = role_id;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public int getAccountant() {
		return accountant;
	}
	public void setAccountant(int accountant) {
		this.accountant = accountant;
	}
	public Date getStart_date() {
		return start_date;
	}
	public void setStart_date(Date start_date) {
		this.start_date = start_date;
	}
	public String getIdentity_card() {
		return identity_card;
	}
	public void setIdentity_card(String identity_card) {
		this.identity_card = identity_card;
	}
	public String getBank_account() {
		return bank_account;
	}
	public void setBank_account(String bank_account) {
		this.bank_account = bank_account;
	}
	public String getBank_name() {
		return bank_name;
	}
	public void setBank_name(String bank_name) {
		this.bank_name = bank_name;
	}
	public String getEmployee_code() {
		return employee_code;
	}
	public void setEmployee_code(String employee_code) {
		this.employee_code = employee_code;
	}
	public int getState() {
		return state;
	}
	public void setState(int state) {
		this.state = state;
	}
	public String getMobile() {
		return mobile;
	}
	public void setMobile(String mobile) {
		this.mobile = mobile;
	}
	public Date getEnd_date() {
		return end_date;
	}
	public void setEnd_date(Date end_date) {
		this.end_date = end_date;
	}
	public String getImg() {
		return img;
	}
	public void setImg(String img) {
		this.img = img;
	}
	
	public Department getDepartment(String lang) {
		MySqlDataAccessHelper mysqlHelper = new MySqlDataAccessHelper();
		
		try {
			mysqlHelper.open();
			String sql = "select * from department,department_lang where department.IDDepartment=department_lang.IDDepartment and department_lang.LangID='"+
			lang+"' and department.IDDepartment="
					+ department_id;
			ResultSet rs = mysqlHelper.executeQuery(sql);
			while (rs.next()) {
				department = new Department();
				department.setiDDepartment(rs.getInt("IDDepartment"));
				department.setDepartmentName(rs.getString("DepartmentName"));
				department.setLocation(rs.getString("Location"));
				department.setDescription(rs.getString("Description"));

			}
			rs.close();
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			mysqlHelper.close();
		}
		return department;
	}

	public void setDepartment(Department department) {
		this.department = department;
	}
}
